Skip to content

Conversation

@bryancall
Copy link
Contributor

Clang 16 and earlier don't fully support constexpr std::string operations even when __cpp_lib_constexpr_string is defined, causing static_assert failures in the compile-time tests for sanitize_metric_name_for_prometheus().

This fix uses nested ifdefs to clearly separate the feature detection from the compiler version check, disabling the constexpr optimization and compile-time tests for Clang <= 16 while keeping them enabled for GCC 13+ and future Clang versions (17+) that may have proper support.

Testing:

  • ✅ Compiles successfully with Clang 16 on Rocky Linux 9
  • ✅ All tests pass including test_cache_Update_Header
  • ✅ No linter errors
  • ✅ Logic is clear and future-proof

Clang 16 and earlier don't fully support constexpr std::string operations
even when __cpp_lib_constexpr_string is defined, causing static_assert
failures in the compile-time tests for sanitize_metric_name_for_prometheus().

This fix uses nested ifdefs to clearly separate the feature detection
from the compiler version check, disabling the constexpr optimization
and compile-time tests for Clang <= 16 while keeping them enabled for
GCC 13+ and future Clang versions (17+) that may have proper support.
@bryancall bryancall added Build work related to build configuration or environment Cleanup labels Nov 21, 2025
@bryancall bryancall self-assigned this Nov 21, 2025
@bryancall bryancall added this to the 10.2.0 milestone Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build work related to build configuration or environment Cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant